package org.vox.homepage.dao

import org.apache.ibatis.`type`.JdbcType
import org.apache.ibatis.annotations.{Mapper, Param, Result, Results, Select}
import org.vox.homepage.dao.entity.User

/**
  * @author Borg.lee
  */
@Mapper
trait UserDao {
  @Select(Array("select id,user_id,password from homepage_user where user_id=#{user_id}"))
  @Results(Array(
    new Result(property = "id", javaType = classOf[Long], column = "id", jdbcType = JdbcType.BIGINT),
    new Result(property = "userId", javaType = classOf[String], column = "user_id", jdbcType = JdbcType.VARCHAR),
    new Result(property = "password", javaType = classOf[String], column = "password", jdbcType = JdbcType.VARCHAR)
  ))
  def getUser(@Param("user_id") userId: String): User
}
